package com.cr.mrapp.service.impl;

import com.cr.mrapp.dao.OrderDao;
import com.cr.mrapp.entity.Order;
import com.cr.mrapp.entity.OrderDetail;
import com.cr.mrapp.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderDao orderDao;
    @Override
    public int add(Order order) {
        return orderDao.insert(order);
    }

    @Override
    public int deleteById(int id) {
        return orderDao.deleteByPrimaryKey(id);
    }

    @Override
    public List<Object> findByPage(int page, int limit) {
        return orderDao.selectByPage((page-1)*limit,limit);
    }

    @Override
    public int findCount() {
        return orderDao.selectCount();
    }

    @Override
    public List<OrderDetail> findMyOrder(String customerName) {
        return orderDao.findMyOrder(customerName);
    }
}
